import xadmin

from apps.operations.models import UserAsk, CourseComments,\
    UserFavorite,UserMessage, UserCourse
from apps.operations.models import Banner

class UserAskAdmin(object):
    list_display = ["name", "mobile", "course_name", "add_time"]
    serach_fields = ["name", "mobile", "course_name"]
    list_filter = ["name", "mobile", "course_name", "add_time"]

class UserCourseAdmin(object):
    list_display = ["user", "course", "add_time"]
    serach_fields = ["user", "course"]
    list_filter = ["user", "course", "add_time"]

class BannerAdmin(object):


    list_display = ["title", "image", "url", "index"]
    serach_fields = ["title", "index"]
    list_filter = ["title", "url", "index"]

class UserMessageAdmin(object):
    list_display = ["user", "message", "has_read", "add_time"]
    serach_fields = ["user", "course", "has_read"]
    list_filter = ["user", "message", "has_read", "add_time"]

class CourseCommentsAdmin(object):
    list_display = ["user", "course", "comment", "add_time"]
    serach_fields = ["user", "course", "comment"]
    list_filter = ["user", "course", "comment", "add_time"]

class UserFavoriteAdmin(object):
    list_display = ["user", "fav_id", "fav_type", "add_time"]
    serach_fields = ["user", "fav_id", "fav_type"]
    list_filter = ["user", "fav_id", "fav_type", "add_time"]

xadmin.site.register(UserAsk, UserAskAdmin)
xadmin.site.register(UserCourse, UserCourseAdmin)
xadmin.site.register(UserMessage, UserMessageAdmin)
xadmin.site.register(CourseComments, CourseCommentsAdmin)
xadmin.site.register(UserFavorite, UserFavoriteAdmin)
xadmin.site.register(Banner, BannerAdmin)